import React, { FC, useEffect, useState } from 'react'
import Header from '@/components/home/header'
import { useAppSelector, useAppDispatch } from '@/store'
import { initCurrendStdAdd } from '@/store/address'
import { selectPayParam, selectPayPrice } from '@/store/payCenter'
import { useNavigate } from 'react-router-dom'
import buyUrl from '@/assets/images/buySuccess.png'
import payUrl from '@/assets/images/pay_success.png'

/**
 * 支付状态页面
 */
const welfare: FC<{}> = () => {
  const navigate = useNavigate()
  const dispatch = useAppDispatch()
  const prise = useAppSelector(selectPayPrice)
  useEffect(() => {}, [])
  //https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx141421524184578a811adb697f164e0000&package=553572278
  //initCurrendStdAdd
  return (
    <div
      className="w-full h-full "
      style={{
        backgroundImage: `url(${payUrl})`,
        backgroundSize: '100% auto',
        backgroundRepeat: 'no-repeat',
      }}
    >
      <Header
        cb={() => {
          navigate(-1)
        }}
        notHeaderColor={true}
        headerText={'购买成功'}
      ></Header>
      <div className=" pt-r6.2 pb-r2.2 pl-r1.2 pr-r1.2 h-auto w-full text-center  relative">
        <div>
          <img
            alt=""
            className="w-r9.1 h-auto relative left-1/2 transform -translate-x-1/2 "
            src={buyUrl}
          ></img>
          <p className="block text-r2.0 leading-r2.0 text-gray-666666 pt-r1.5 ">购买成功</p>
        </div>

        <span className="block text-r1.4  mt-r1.2 font-regular text-gray-666666">
          {' '}
          <span>￥</span>
          {prise}111
        </span>
      </div>
      <div>
        <div className="h-r5.9 text-r1.6 leading-r5.9 w-full relative  ">
          <span
            onClick={() => {
              navigate('/orderList')
            }}
            className=" shadow-bs4 absolute  left-r6.8 text-r1.5 border h-r4.0 w-r11.2 text-orange-FF3627 leading-r4.0 rounded-r2.0  inline-block text-center mr-r1.6"
          >
            查看订单
          </span>
          <span
            onClick={() => {
              // navigate('/payment')
            }}
            className=" shadow-bs4 absolute right-r6.8  h-r4.0 w-r11.2  text-white leading-r4.0 rounded-r2.0  bg-gradient-to-r from-orange-FF664F to-orange-FF3627 inline-block text-center "
          >
            继续购课
          </span>
        </div>
      </div>
    </div>
  )
}

export default welfare
